package com.cos.blog.controller.web;

import com.cos.blog.core.servlet.BaseServlet;
import com.cos.blog.services.IInvitataionService;
import com.cos.blog.services.impl.InvitataionServiceImpl;
import com.cos.blog.vo.IndexDataVo;

import javax.servlet.annotation.WebServlet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author:zxc
 * @Description: 跳转blog页面
 */
@WebServlet("/IndexServlet/*")
public class IndexServlet extends BaseServlet {
    private IInvitataionService invitataionService = new InvitataionServiceImpl();

    public void index() throws Exception {

        // 1.获取数据
        List<IndexDataVo> list = invitataionService.indexDataList();

        // 2.放到Map中
        Map<String, Object> map = new HashMap<>();
        map.put("indexDataVoList", list);
//        System.out.println("11");
        // 3.跳转到视图
        outView("view/index", map);
    }
}
